//
//  EquipmentRepairCell.m
//  PropertyMananger
//
//  Created by bh on 17/2/8.
//  Copyright © 2017年 BH. All rights reserved.
//

#import "EquipmentRepairCell.h"

@implementation EquipmentRepairCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}
+ (instancetype)cellWithTableView:(UITableView *)tableView
{
    static NSString *cellID = @"EquipmentRepairCellID";
    EquipmentRepairCell *cell = [tableView dequeueReusableCellWithIdentifier:cellID];
    if(cell == nil) {
        cell = [[EquipmentRepairCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellID];
    }
    //选中cell的颜色 -无色
    cell.selectionStyle = UITableViewCellSelectionStyleNone;
    
    
    return cell;
    
}
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        
        self.equipmentCodeLabel = [[UILabel alloc]init];
        [self.contentView addSubview:self.equipmentCodeLabel];
        
        self.equipmentCodeLabel.textColor = BHColor(51, 51, 51);
        self.equipmentCodeLabel.textAlignment = NSTextAlignmentLeft;
        self.equipmentCodeLabel.font = BHFont(15);
        self.equipmentCodeLabel.textColor = Theme_Color;
        self.equipmentCodeLabel.text = @"设备编号：2323434343433";
        //  self.equipmentCodeLabel.backgroundColor = BHRandColor;
        
        [self.equipmentCodeLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.leading.equalTo(self).with.offset(15);
            make.top.equalTo(self).with.offset(12.5);
            make.size.mas_equalTo(CGSizeMake(BHscreenW - 95, 25));
        }];
        
        UIImageView * arrowImg = [[UIImageView alloc]init];
        [self.contentView addSubview:arrowImg];
        arrowImg.image = IMG(@"ico_work_order_next");
        
        [arrowImg mas_makeConstraints:^(MASConstraintMaker *make) {
            make.trailing.equalTo(self).with.offset(-15);
            make.centerY.equalTo(self.equipmentCodeLabel).with.offset(0);
            make.size.mas_equalTo(CGSizeMake(8, 14));
        }];
        
        UIView * lineView = [[UIView alloc]init];
        [self.contentView addSubview:lineView];
        
        lineView.backgroundColor = BHColor(230, 230, 230);
        [lineView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.leading.equalTo(self).with.offset(0);
            make.size.mas_equalTo(CGSizeMake(BHscreenW, 1));
            make.top.equalTo(self.equipmentCodeLabel.mas_bottom).with.offset(12.5);
        }];
        
        UILabel * equipmentNameLabel = [[UILabel alloc]init];
        [self.contentView addSubview:equipmentNameLabel];
        
        equipmentNameLabel.textColor = BHColor(102, 102, 102);
        equipmentNameLabel.textAlignment = NSTextAlignmentLeft;
        equipmentNameLabel.font = BHFont(15);
        equipmentNameLabel.text  = @"设备名称:";
        
        [equipmentNameLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.leading.equalTo(self).with.offset(15);
            make.top.equalTo(lineView).with.offset(15);
            make.size.mas_equalTo(CGSizeMake(70, 25));
        }];
        
        self.equipmentNameLabel = [[UILabel alloc]init];
        [self.contentView addSubview:self.equipmentNameLabel];
        
        self.equipmentNameLabel.textColor = BHColor(51, 51, 51);
        self.equipmentNameLabel.textAlignment = NSTextAlignmentLeft;
        self.equipmentNameLabel.font = BHFont(15);
        self.equipmentNameLabel.text  = @"监控摄像头";
        // self.complianManLabel.backgroundColor = BHRandColor;
        
        [self.equipmentNameLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.leading.equalTo(equipmentNameLabel.mas_trailing).with.offset(0);
            make.top.equalTo(equipmentNameLabel).with.offset(0);
            make.size.mas_equalTo(CGSizeMake(BHscreenW/3, 25));
        }];
        
        UILabel * equipmentTypeLabel = [[UILabel alloc]init];
        [self.contentView addSubview:equipmentTypeLabel];
        
        equipmentTypeLabel.textColor = BHColor(102, 102, 102);
        equipmentTypeLabel.textAlignment = NSTextAlignmentLeft;
        equipmentTypeLabel.font = BHFont(15);
        equipmentTypeLabel.text  = @"规格型号:";
        
        [equipmentTypeLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.leading.equalTo(equipmentNameLabel).with.offset(0);
            make.top.equalTo(equipmentNameLabel.mas_bottom).with.offset(10);
            make.size.mas_equalTo(CGSizeMake(70, 25));
        }];
        
        self.equipmentTypeLabel = [[UILabel alloc]init];
        [self.contentView addSubview:self.equipmentTypeLabel];
        
        self.equipmentTypeLabel.textColor = BHColor(51, 51, 51);
        self.equipmentTypeLabel.textAlignment = NSTextAlignmentLeft;
        self.equipmentTypeLabel.font = BHFont(15);
        self.equipmentTypeLabel.text  = @"WFH-455454";
        //   self.timeLabel.backgroundColor = BHRandColor;
        
        [self.equipmentTypeLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.leading.equalTo(equipmentTypeLabel.mas_trailing).with.offset(0);
            make.top.equalTo(equipmentTypeLabel).with.offset(0);
            make.size.mas_equalTo(CGSizeMake(BHscreenW/2+50, 25));
        }];
        
        UILabel * repairManLabel = [[UILabel alloc]init];
        [self.contentView addSubview:repairManLabel];
        
        repairManLabel.textColor = BHColor(102, 102, 102);
        repairManLabel.textAlignment = NSTextAlignmentLeft;
        repairManLabel.font = BHFont(15);
        repairManLabel.text  = @"检  修  人:";
        
        [repairManLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.leading.equalTo(equipmentTypeLabel).with.offset(0);
            make.top.equalTo(equipmentTypeLabel.mas_bottom).with.offset(10);
            make.size.mas_equalTo(CGSizeMake(70, 25));
        }];
        
        self.repairManLabel = [[UILabel alloc]init];
        [self.contentView addSubview:self.repairManLabel];
        
        self.repairManLabel.textColor = BHColor(51, 51, 51);
        self.repairManLabel.textAlignment = NSTextAlignmentLeft;
        self.repairManLabel.font = BHFont(15);
        self.repairManLabel.text  = @"新大黑";
        
        [self.repairManLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            
            make.leading.equalTo(repairManLabel.mas_trailing).with.offset(0);
            make.centerY.equalTo(repairManLabel).with.offset(0);
            make.size.mas_equalTo(CGSizeMake(BHscreenW/3, 50));
        }];
        
        UILabel * repairTimeLabel = [[UILabel alloc]init];
        [self.contentView addSubview:repairTimeLabel];
        
        repairTimeLabel.textColor = BHColor(102, 102, 102);
        repairTimeLabel.textAlignment = NSTextAlignmentLeft;
        repairTimeLabel.font = BHFont(15);
        repairTimeLabel.text  = @"检修时间:";
        
        [repairTimeLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.leading.equalTo(repairManLabel).with.offset(0);
            make.top.equalTo(repairManLabel.mas_bottom).with.offset(10);
            make.size.mas_equalTo(CGSizeMake(70, 25));
        }];
        
        self.repairTimeLabel = [[UILabel alloc]init];
        [self.contentView addSubview:self.repairTimeLabel];
        
        self.repairTimeLabel.textColor = BHColor(51, 51, 51);
        self.repairTimeLabel.textAlignment = NSTextAlignmentLeft;
        self.repairTimeLabel.font = BHFont(15);
        self.repairTimeLabel.numberOfLines = 3;
        self.repairTimeLabel.text  = @"2017-02-23";
        
        [self.repairTimeLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            
            make.leading.equalTo(repairTimeLabel.mas_trailing).with.offset(0);
            make.centerY.equalTo(repairTimeLabel).with.offset(0);
            make.size.mas_equalTo(CGSizeMake(BHscreenW - 100, 25));
        }];
        
    }
    return self;
}

@end
